<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>函数的定义和调用</title>
</head>
<body>
  <script>
    function getSum(){
      var sum=0;
      for(var i=1;i<=100;i++){
        sum +=i;
      }
      document.write('1到100的数相加和是:'+sum);
    }
    getSum();
    </script>
    </body>
</html>
 